#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H

#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QPushButton>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QPainter>
#include <QRegularExpression>
#include <QRegularExpressionValidator>
#include <QFont>
#include <QAction>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QMessageBox>

#include <http.h>

class LoginWidget : public QWidget
{
    Q_OBJECT
public:
    explicit LoginWidget(QWidget *parent = nullptr);
    bool allowlogin=false;

signals:
    void login(const QString&userid,const QString&password);

public slots:
    void RemberPassword();
    void VisibleToInvisible();
    void InvisibleToVisible();
protected:
    void paintEvent(QPaintEvent* e)override;
    void mousePressEvent(QMouseEvent*e)override;
    void mouseMoveEvent(QMouseEvent*e)override;
    void mouseReleaseEvent(QMouseEvent*e)override;
    void keyPressEvent(QKeyEvent*event)override;
private slots:
    void Login();
private:

    QPushButton*closebtn;
    QAction*visible,*invisible;
    QLabel*loginlabel,*passwordlabel;
    QLineEdit*loginline,*passwordline;
    QPushButton*loginbtn;
    QString id,password;
    QCheckBox*remember;
    QRegularExpression regex;
    bool rememberstate=false;

    bool isdrag = false;
    QPointF startpoint;

};

#endif // LOGINWIDGET_H
